﻿using Project_Maverick.Content.Images.Background;
using Transformable_Engine_v2.Engine.GameObjects.Containers;
using Transformable_Engine_v2.Engine.Transformable_Math.Geometry;

namespace Project_Maverick.Screen.Common
{
    public class Title : Container
    {
        private ImageContainer _triangleLeft, _triangleRight;

         public Title(string title)
         {
             AddChildren(new ImageContainer
                             {
                                 Sprite = SpriteSheetBackground.GetSprite(SpriteSheetBackground.Common.TitleImage)
                             });

             AddChildren(new DefaultLabel(title)
                             {
                                 TextAlign = TE_Rectangle.Alignment.CenterMiddle,
                                 PositionGridBound = new TE_Vector2(24, 3)
                             });


             _triangleLeft = new ImageContainer
                                 {
                                     PositionGridBound = new TE_Vector2(48, 0),
                                     Sprite =
                                         SpriteSheetBackground.GetSprite(SpriteSheetBackground.Common.TitleTriangles)
                                 };

             _triangleRight = new ImageContainer
                                  {
                                      Sprite =
                                          SpriteSheetBackground.GetSprite(SpriteSheetBackground.Common.TitleTriangles),
                                      Mirror = ImageContainer.MirrorState.MirrorHorizontal,
                                      Origin = TE_Rectangle.Alignment.TopRight
                                  };

             AddChildren(_triangleLeft, _triangleRight);

         }

        public void Exit()
        {
            _triangleLeft.Sprite = SpriteSheetBackground.GetSprite(SpriteSheetBackground.Common.TitleAlternateTriangles);
            _triangleRight.Sprite = SpriteSheetBackground.GetSprite(SpriteSheetBackground.Common.TitleAlternateTriangles);
        }
    }
}